POP3Socket Class
Used to retrieve and manage messages on a POP3 mail server.
More information available in parent classes: TCPSocket:SocketCore:Object
Notes
If you use a constructor in a subclass of POP3Socket, you must call the Super class's constructor in your subclass's constructor. The subclass will not work unless this is done.
Examples
The following example in the Action event of a PushButton establishes a connection to a POP3 server. The POP3Socket control, POP3Socket1, has been added to the window. The method gets the name of the server, username, and password from the contents of the EditFields, ServerFld, UserNameFld, and PasswordFld.
//get POP3 sever address and port to use
POP3socket1.Address = ServerFld.text
POP3socket1.Port = 110
//get account info
POP3Socket1.Username = UsernameFld.text
POP3Socket1.Password = passwordFld.text
//establish connection
POP3Socket1.connect
Me.Caption = "Disconnect" //change button text while connected
else
POP3Socket1.DisconnectFromServer
Me.caption = "Connect"
End if
The following example in the MessageReceived event of the POP3Socket control, displays the message in the multiline EditField, BodyFld.
Dim s as String
// display the message
s = Email.bodyHTML
if s = "" then
s = Email.bodyPlainText
end if
BodyFld.text = ReplaceAll(s, Chr(13)+ Chr(10), Chr(13))
The following example in the TopLinesReceived event populates a ListBox with summary information on the email that was received. After populating the ListBox, it checks against the window property MessageTotal, which contains the result from a call to CountMessages, to see if there are any more message on the server. MessageTotal is assigned the value of the Count parameter in the MessageCount event
// headers received. populate the Listbox
ListBox1.AddRow Email.Subject()
ListBox1.Cell(ListBox1.lastIndex,1) = Email.FromAddress()
ListBox1.Cell(ListBox1.lastIndex,2) = Str(ID)
if ID < MessageTotal then // there are still messages left
Me.RetrieveLines id+1,0/ / get the next message headers
End if
.
See Also
EmailMessage, HTTPSocket, SMTPSocket, SocketCore, TCPSocket classes.